package org.mercworks.knight.physics.bodies;

import org.mercworks.knight.physics.KnightWorldPhysics;
import org.odejava.Body;
import org.odejava.GeomBox;

public class KnightBody extends Body
{
	private static final String KNIGHT = "knight";
	private float[] m_bodyPos;
	private GeomBox m_geomBox;
	
	public KnightBody()
	{
		super(KNIGHT, KnightWorldPhysics.getWorldInstance());
		m_geomBox = new GeomBox(20.0f, 100.0f, 10.0f);
		m_geomBox.setName(KNIGHT);
		this.addGeom(m_geomBox);
		this.adjustMass(10.0f);
		this.setPosition(10.0f, 40.0f, 5.0f);
		
		KnightWorldPhysics.getCollisionSpaceInstance().addBodyGeoms(this);
		
		m_bodyPos = new float[3];
	}
	
	public float[] getBodyPos()
	{
		return m_bodyPos;
	}
	
	public float getBodyPosX()
	{
		return m_bodyPos[0];
	}
	
	public float getBodyPosY()
	{
		return m_bodyPos[1];
	}
	
	public void setBodyPosY(float y)
	{
		m_bodyPos[1] = 0.0f;
	}
	
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append("X Position: " + m_bodyPos[0] + "\n");
		sb.append("Y Position: " + m_bodyPos[1] + "\n");
		sb.append("Z Position: " + m_bodyPos[2] + "\n");
		sb.append("MASS: " + this.getMass());
		return sb.toString();
	}
}
